// Fill out your copyright notice in the Description page of Project Settings.


#include "NameGM.h"
#include "Kismet/GameplayStatics.h"
#include "../MySQL/MySQLSubsystem.h"
#include "UnLua.h"

void ANameGM::BeginPlay()
{
	Super::BeginPlay();
	UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
	MySQLSubIns= GameInstance->GetSubsystem<UMySQLSubsystem>();
	if (MySQLSubIns)
	{
		MySQLSubIns->JoinDB();
	}
	FString UIName = TEXT("name");
	UnLua::CallTableFunc(UnLua::GetState(), "UI", "OpenUI", this,UIName);
	
}

void ANameGM::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
	Super::EndPlay(EndPlayReason);
	UnLua::CallTableFunc(UnLua::GetState(), "UI", "Uninstall");
}
